﻿#region Using Directives

    using System;
    using System.Collections.Generic;

    using Csla;
    using Csla.Security;

#endregion

namespace MarketPulse.BusinessLogic.Core.Criteria
{
    /// <summary>
    /// Criteria class that allows a User to be uniquely identified.
    /// </summary>
    [Serializable]
    public class SystemAuthenticationCriteria : CriteriaBase<SystemAuthenticationCriteria>
    {

        #region Constructors

            /// <summary>
            /// Overloaded constructor for this class
            /// </summary>
            /// <param name="username">The username of the user to associate with this criteria</param> 
            /// <param name="password">The password supplied by the user to associate with this criteria</param>
            /// <param name="profileTypeGUID">The GUID of the profile type (system) to associate with this criteria</param>
            public SystemAuthenticationCriteria(string username, string password, Guid profileTypeGUID)
            {
                Username = username;
                Password = password;
                ProfileTypeGUID = profileTypeGUID;
            }

            /// <summary>
            /// Overloaded constructor for this class
            /// </summary>
            /// <param name="userGUID">The userGUID of the user to associate with this criteria</param> 
            /// <param name="privateKey">The private key generated for the user to associate with this criteria.</param>
            /// <param name="profileTypeGUID">The GUID of the profile type (system) to associate with this criteria</param>
            public SystemAuthenticationCriteria(Guid userGUID, string privateKey, Guid profileTypeGUID)
            {
                UserGUID = userGUID;
                PrivateKey = privateKey;
                ProfileTypeGUID = profileTypeGUID;
            }

        #endregion

        #region Properties

            /// <summary>
            /// Username property definition.
            /// </summary>
            public static readonly PropertyInfo<string> UsernameProperty = RegisterProperty<string>(c => c.Username);
            /// <summary>
            /// Username property definition.
            /// </summary>
            public string Username
            {
                get { return ReadProperty(UsernameProperty); }
                private set { LoadProperty(UsernameProperty, value); }
            }

            /// <summary>
            /// Password property definition.
            /// </summary>
            public static readonly PropertyInfo<string> PasswordProperty = RegisterProperty<string>(c => c.Password);
            /// <summary>
            /// Password property definition.
            /// </summary>   
            public string Password
            {
                get { return ReadProperty(PasswordProperty); }
                private set { LoadProperty(PasswordProperty, value); }
            }

            /// <summary>
            /// This is the unique identifier of the profile type (system) for this criteria
            /// </summary>
            public static readonly PropertyInfo<Guid> ProfileTypeGUIDProperty = RegisterProperty<Guid>(p => p.ProfileTypeGUID);
            /// <summary>
            /// This is the unique identifier of the profile type (system) for this criteria
            /// </summary>
            public Guid ProfileTypeGUID
            {
                get { return ReadProperty(ProfileTypeGUIDProperty); }
                private set { LoadProperty(ProfileTypeGUIDProperty, value); }
            }

            /// <summary>
            /// UserGUID property definition.
            /// </summary>
            public static readonly PropertyInfo<Nullable<Guid>> UserGUIDProperty = RegisterProperty<Nullable<Guid>>(c => c.UserGUID);
            /// <summary>
            /// UserGUID property definition.
            /// </summary>
            public Nullable<Guid> UserGUID
            {
                get { return ReadProperty(UserGUIDProperty); }
                private set { LoadProperty(UserGUIDProperty, value); }
            }

            /// <summary>
            /// PrivateKey property definition.
            /// </summary>
            public static readonly PropertyInfo<string> PrivateKeyProperty = RegisterProperty<string>(c => c.PrivateKey);
            /// <summary>
            /// PrivateKey property definition.
            /// </summary>
            public string PrivateKey
            {
                get { return ReadProperty(PrivateKeyProperty); }
                private set { LoadProperty(PrivateKeyProperty, value); }
            }

        #endregion

    }
}
